@{
    ViewBag.Title = "js在线加密混淆";
    ViewBag.keywords = "javascript混淆,javascript压缩,javascript加密,JS混淆,JS压缩,JS加密,javascript混淆工具,javascript混淆器,javascript加密器,javascript混淆加密器,javascript在线混淆,JS混淆工具,JS混淆器,JS加密器,js混淆加密器,JS在线混淆";
    ViewBag.description = "这款js加密解密工具可实现基于eval方法的加密与解密功能，用户可将js代码加密成eval方法执行形式的代码，也可将eval方法加密过的代码进行解密操作。并且提供了在线运行js代码的功能,提供对js的排版（格式化），混淆，压缩，加密功能";
    var host = Appsettings.app("BaseFile:HostUrl");
}
<div class="layui-row layui-form layui-form-pane">
    <div class="layui-form jscodem">
        <div class="layui-elem-quote">
            这款聊天内容加密解密工具可实现针对聊天内容自定义暗号进行加密与解密的功能，加密与解密的聊天内容可以是中英文、字母、数字及特殊符号等。
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">内容：</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="content" name="content" rows="8" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <a class="layui-btn enc">加密</a>
            <a class="layui-btn layui-btn-normal dec">解密</a>
            <a class="layui-btn layui-btn-danger cle">清空</a>
            <a class="layui-btn layui-btn-primary dem">示例</a>
            <a class="layui-btn layui-btn-primary copy">复制结果</a>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">输出：</label>
            <div class="layui-input-block">
                <textarea placeholder="输出内容" id="outtxt" name="outtxt" rows="8" autocomplete="off" class="layui-textarea"></textarea>
            </div>
        </div>
    </div>
</div>
@section Scripts{
<script>
    var JsCodem = { compile: function (obj) { var txtcode = obj.value; var c = String.fromCharCode(txtcode.charCodeAt(0) + txtcode.length); for (var i = 1; i < txtcode.length; i++) { var x = String.fromCharCode(txtcode.charCodeAt(i) + txtcode.charCodeAt(i - 1)); c += x; } return escape(c); }, uncompile: function (obj) {            var code = obj.value;            code = unescape(code);            var c = String.fromCharCode(code.charCodeAt(0) - code.length);            for (var i = 1; i < code.length; i++) {                var x = String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1));                c += x;            }            return c;        }    };
    layui.config({ base: '@host/js/' }).use('common',function(){var common=layui.common;$=layui.jquery;
          let area_input = document.getElementById('content');
          let area_output = document.getElementById('outtxt');
        $(".jscodem .enc").bind("click", function () {
            var code = area_input.value;
            if (code === undefined || code === '' || code === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
            area_output.value = JsCodem.compile(area_input);
        });
        $(".jscodem .dec").bind("click", function () {
            var code = area_input.value;
            if (code === undefined || code === '' || code === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
            code = code.replace(/^eval/, '');
            var data = JsCodem.uncompile(area_input);
            area_output.value = data;
        });
        $(".jscodem .dem").bind("click", function () {$("#content").val("var showmsg='粘贴要加密 / 解密的javascript代码到这里';\nif(1==0){\n  alert(showmsg);\n}"); });});
</script>
}